{layout name="layout/main"/}
<div class="flexbox">
    <h1 class="h2">商品管理</h1>
    <a href="{:url('publish')}" class="btn btn-sm btn-primary">添加商品</a>
</div>

<table class="table table-bordered">
    <thead>
    <tr>
        <th>ID</th>
        <th>名称</th>
        <th>图片</th>
        <th>价格</th>
        <th>库存</th>
        <th>状态</th>
        <th>添加时间</th>
        <th>更新时间</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    {volist name="list" id="item"}
    <tr>
        <td>{$item.id}</td>
        <td>{$item.title}</td>
        <td>
            <img src="{$item.thumb}" width="32" height="32" alt="">
        </td>
        <td>￥{$item.price}</td>
        <td>{$item.stock}</td>
        <td>
            {eq name="item.status" value="1"}
            <span class="label label-success">上架</span>
            {else/}
            <span class="label label-danger">下架</span>
            {/eq}
        </td>
        <td>{$item.created_at}</td>
        <td>{$item.updated_at}</td>
        <td>
            <a href="{:url('/admin/goods/update',['id'=>$item['id']])}" class="btn btn-sm btn-default">编辑</a>
            <a onclick="return confirm('确定删除吗?')" href="{:url('/admin/goods/do_delete',['id'=>$item['id']])}"
               class="btn btn-sm btn-danger">删除</a>
        </td>
    </tr>
    {/volist}
    </tbody>
</table>
{$page}